export default {
	// 开启命名空间
	namespaced: true,

	// state 数据
	state: {
		money: uni.getStorageSync('money') || 100000
	},

	// 方法
	mutations: {
		// 增加余额
		addmoney(state, addpay) {
			state.money = parseFloat(state.money) + parseFloat(addpay)
			this.commit('m_account/savemoney')
		},
		// 更新余额
		updatamoney(state, pay) {
			state.money = parseFloat(state.money) - parseFloat(pay)
			this.commit('m_account/savemoney')
		},
		// 存储余额
		savemoney(state) {
			uni.setStorageSync('money', state.money)
		},

	},

	// 数据包装器
	getters: {
		getmoney(state) {
			return state.money
		}
	},
}